/**
 * col_color
 */
layui.define(['YunjColsTemplet','jquery','yunj'], function (exports) {

    let YunjColsTemplet = layui.YunjColsTemplet;
    let doc = document;
    let $ = layui.jquery;

    class YunjColsTempletColor extends YunjColsTemplet{

        constructor(options) {
            super(options);
        }

        layout(){
            let that=this;
            return `{{# let color = d.${that.key}; }}
                     {{# if(color){ }}
                     <div class="table-row-color" title="复制色号:{{ color }}" data-color="{{ color }}" style="border-color:{{ color }};">
                        {{ color }}
                    </div>
                     {{# } }}`;
        }

        defineExtraEventBind(){
            let that=this;

            $(doc).on('click','.table-row-color',function () {
                yunj.copy($(this).data('color'));
            });
        }

    }

    exports('col_color', YunjColsTempletColor);
});